home *** CD-ROM | disk | FTP | other *** search
-
-
-
- ppppcccciiiiiiiioooo((((DDDD3333)))) ppppcccciiiiiiiioooo((((DDDD3333))))
-
-
-
- NNNNAAAAMMMMEEEE
- pciio: pciio_driver_register, pciio_driver_unregister, pciio_iterate,
- pciio_reset - control PCI driver infrastructure
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////PPPPCCCCIIII////ppppcccciiiiiiiioooo....hhhh>>>>
-
- iiiinnnntttt
- ppppcccciiiiiiiioooo____ddddrrrriiiivvvveeeerrrr____rrrreeeeggggiiiisssstttteeeerrrr ((((
- ppppcccciiiiiiiioooo____vvvveeeennnnddddoooorrrr____iiiidddd____tttt _v_e_n_d_o_r__i_d,,,,
- ppppcccciiiiiiiioooo____ddddeeeevvvviiiicccceeee____iiiidddd____tttt _d_e_v_i_c_e__i_d,,,,
- cccchhhhaaaarrrr ****_d_r_i_v_e_r__p_r_e_f_i_x,,,,
- uuuunnnnssssiiiiggggnnnneeeedddd _f_l_a_g_s))));;;;
-
- vvvvooooiiiidddd
- ppppcccciiiiiiiioooo____ddddrrrriiiivvvveeeerrrr____uuuunnnnrrrreeeeggggiiiisssstttteeeerrrr ((((cccchhhhaaaarrrr ****_d_r_i_v_e_r__p_r_e_f_i_x))));;;;
-
- vvvvooooiiiidddd
- ppppcccciiiiiiiioooo____iiiitttteeeerrrraaaatttteeee ((((
- cccchhhhaaaarrrr ****_d_r_i_v_e_r__p_r_e_f_i_x,,,,
- ppppcccciiiiiiiioooo____iiiitttteeeerrrr____ffff ****_f_u_n_c))));;;;
- vvvvooooiiiidddd
- ppppcccciiiiiiiioooo____rrrreeeesssseeeetttt ((((vvvveeeerrrrtttteeeexxxx____hhhhddddllll____tttt _p_c_o_n_n))));;;;
-
- AAAArrrrgggguuuummmmeeeennnnttttssss
- _v_e_n_d_o_r__i_d
- _d_e_v_i_c_e__i_d Values that the PCI device will present in its configuration
- space as its vendor and device ID codes.
-
- _d_r_i_v_e_r__p_r_e_f_i_x
- The prefix string for the driver's standard entry points as
- configured in /_v_a_r/_s_y_s_g_e_n/_s_y_s_t_e_m. The infrastructure uses
- this prefix to locate the driver's cdevsw entry, in order to
- call the driver's attach and detach entry points.
-
- _f_l_a_g_s Normally passed as zero.
-
- _f_u_n_c Address of a function to be applied to each of the connection
- points attached by this driver.
-
- _p_c_o_n_n is an appropriate PCI connection point.
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- The PCI infrastructure is a package of kernel services used by drivers
- for PCI devices to set up services for their devices. These services
- include:
-
- +o Locating all instances of the device in the system (documented in
- this page).
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- ppppcccciiiiiiiioooo((((DDDD3333)))) ppppcccciiiiiiiioooo((((DDDD3333))))
-
-
-
- +o Manipulating the PCI configuration space for the device (see
- _p_c_i_i_o__c_o_n_f_i_g(D3)).
-
- +o Constructing physical addresses to use for PIO access to the device
- (see _p_c_i_i_o__p_i_o(D3)).
-
- +o Constructing PCI addresses for the device to use for DMA access to
- memory (see _p_c_i_i_o__d_m_a(D3)).
-
- +o Arranging for a function to be called when the device requests
- interrupt service (see _p_c_i_i_o__i_n_t_r(D3)).
-
- +o Arranging for a function to be called when an error occurs during PIO
- to, or DMA from the device (see _p_c_i_i_o__e_r_r_o_r(D3)).
-
- +o Accessing useful fields in some otherwise opaque data structures (see
- _p_c_i_i_o__g_e_t(D3)).
-
- DDDDrrrriiiivvvveeeerrrr RRRReeeeggggiiiissssttttrrrraaaattttiiiioooonnnn
- _p_c_i_i_o__d_r_i_v_e_r__r_e_g_i_s_t_e_r() is used by drivers to inform the infrastructure
- that they are interested in all PCI devices designated by specified
- device and vendor ID numbers. The infrastructure associates the
- specified ID numbers with the specified device driver prefix. When a
- device with these IDs is discovered, the infrastructure calls the attach
- entry point with that driver prefix, passing the hardware graph
- connection point vertex as the only parameter. This _c_o_n_n_e_c_t_i_o_n _p_o_i_n_t is
- used in most calls to the infrastructure to identify the PCI device of
- interest.
-
- A loadable device driver calls _p_c_i_i_o__d_r_i_v_e_r__r_e_g_i_s_t_e_r() from its _r_e_g()
- entry point. A driver prelinked into the kernel should also make the
- call from _r_e_g() for consistency, but may call from the _i_n_i_t() entry point
- if necessary.
-
- Device drivers may make multiple calls with different vendor and device
- ID numbers, representing several compatible PCI devices.
-
- Wildcard values PCIIO_VENDOR_ID_NONE and PCIIO_DEVICE_ID_NONE may be used
- if cards from any vendor or cards with any device code are of supported.
- When both vendor and device are wildcarded, the _a_t_t_a_c_h() routine is
- called for every PCI device connected to the system.
-
- When a loadable device driver calls _p_c_i_i_o__d_r_i_v_e_r__r_e_g_i_s_t_e_r(), one or more
- calls to the driver's _a_t_t_a_c_h() function can occur before the
- infrastructure returns control to the caller. On some large systems, the
- _a_t_t_a_c_h() calls can be executed by other threads and possibly on other
- processors, concurrently with continued execution of the _r_e_g() entry
- point.
-
- _p_c_i_i_o__d_r_i_v_e_r__u_n_r_e_g_i_s_t_e_r() should be called by any unloadable device
- driver, from within the driver's _u_n_r_e_g() entry point. This will trigger
- calls to the driver's _d_e_t_a_c_h() entry point, and remove the association
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- ppppcccciiiiiiiioooo((((DDDD3333)))) ppppcccciiiiiiiioooo((((DDDD3333))))
-
-
-
- between the driver and any vendor and device IDs.
-
- CCCCoooonnnnnnnneeeeccccttttiiiioooonnnn PPPPooooiiiinnnntttt IIIItttteeeerrrraaaattttiiiioooonnnn
- It is sometimes important for driver code to be able to go back and
- revisit each connection point that was passed to its _a_t_t_a_c_h() entry
- point; for example to disconnect interrupt and error handling functions
- before the driver unloads, or to reconnect these handlers after the
- driver is reloaded. _p_c_i_i_o__i_t_e_r_a_t_e() provides a quick mechanism to have a
- private function called with each connection point that the
- infrastructure has matched with the specified driver.
-
- On large systems, the calls to _f_u_n_c() can take place in multiple separate
- threads on multiple processors, so the function must use appropriate
- locking when accessing driver-global structures.
-
- RRRReeeesssseeeettttttttiiiinnnngggg aaaa PPPPCCCCIIII ccccaaaarrrrdddd
- _p_c_i_i_o__r_e_s_e_t() is used to attempt to activate the PCI Reset line connected
- to a specific card without affecting other devices on the PCI bus. When
- this can be done, the device is reset and basic configuration information
- is reloaded.
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
- Here is how a typical driver might make use of these functions:
-
- static char pcifoo_prefix[] = "pcifoo_";
- static char pcifoo_edge[] = "foo";
- pcifoo_init(void)
- {
- /* the first time through, we are not
- * registered, so this is a no-op.
- * after that, it triggers reload_me.
- */
- pciio_iterate(pcifoo_prefix, pcifoo_reload_me);
- }
- pcifoo_unload(void)
- {
- ...
- pciio_iterate(pcifoo_prefix, pcifoo_unload_me);
- ...
- }
- pcifoo_reg(void)
- {
- pciio_driver_register(
- PCIFOO_VENDOR_ID,
- PCIFOO_DEVICE_ID,
- pcifoo_prefix, 0);
- }
- pcifoo_unreg(void)
- {
- pciio_driver_unregister(pcifoo_prefix);
- }
- pcifoo_reload_me(vertex_hdl_t conn)
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- ppppcccciiiiiiiioooo((((DDDD3333)))) ppppcccciiiiiiiioooo((((DDDD3333))))
-
-
-
- {
- vertex_hdl_t vhdl;
- pcifoo_soft_t pcifoo_soft;
- if (GRAPH_SUCCESS !=
- hwgraph_traverse(conn, pcifoo_edge, &vhdl))
- return;
- pcifoo_soft = device_info_get(vhdl);
- if (!pcifoo_soft)
- return;
- if (pcifoo_soft->intr)
- pciio_intr_connect(
- pcifoo_soft->intr,
- pcifoo_intr,
- pcifoo_soft);
- }
- pcifoo_unload_me(vertex_hdl_t conn)
- {
- vertex_hdl_t vhdl;
- pcifoo_soft_t pcifoo_soft;
- if (GRAPH_SUCCESS !=
- hwgraph_traverse(conn, pcifoo_edge, &vhdl))
- return;
- pcifoo_soft = device_info_get(vhdl);
- if (pcifoo_soft->intr)
- pciio_intr_disconnect(pcifoo_soft->intr);
- }
-
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- pciio_config(D3), pciio_dma(D3), pciio_error(D3), pciio_get(D3),
- pciio_intr(D3), pciio_pio(D3).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-